#!/usr/bin/python
# -*- coding: UTF-8 -*-

import tkinter as tk

# 创建窗体
window = tk.Tk()
window.title('Tk Demo')
window.geometry('350x500')

var = tk.StringVar()
l = tk.Label(
    window,
    bg='yellow',
    width=4,
    textvariable=var
)
l.pack()


def print_selection():
    l.config(text='you have select' + var.get())


r1 = tk.Radiobutton(
    window,
    text='option A',
    variable=var,
    value='A',
    command=print_selection
)
r1.pack()

r1 = tk.Radiobutton(
    window,
    text='option B',
    variable=var,
    value='B',
    command=print_selection
)
r1.pack()

r1 = tk.Radiobutton(
    window,
    text='option C',
    variable=var,
    value='C',
    command=print_selection
)
r1.pack()


window.mainloop()

